

freduse UNRATE USREC, clear
gen datem = mofd(daten)
format datem %tm
drop daten date
keep if datem>=ym(1964,1) & datem<=ym(2016,12)
tsset datem

* convert from percentage terms to rates (e.g. 5%=0.05)
gen U = UNRATE/100

tsfilter hp U_hp = U, smooth(14400)
sum U U_hp

* report values in percentage terms
gen dUhp_12 = 100*(F12.U_hp - U_hp)
gen dUhp_24 = 100*(F24.U_hp - U_hp)
gen dUhp_36 = 100*(F36.U_hp - U_hp)
gen dUhp_48 = 100*(F48.U_hp - U_hp)
gen dUhp_60 = 100*(F60.U_hp - U_hp)

corr dUhp_12 F12.dUhp_12 F12.dUhp_24 F12.dUhp_36 F12.dUhp_48 F12.dUhp_60 if USREC==0, covariance
corr dUhp_12 F12.dUhp_12 F12.dUhp_24 F12.dUhp_36 F12.dUhp_48 F12.dUhp_60 if USREC==1, covariance